﻿Imports System.Data
Imports VSModel
Imports Cls_Common
Imports SecurityService

Partial Class Control_MSDS_Section13View
    Inherits System.Web.UI.UserControl
	Private Shared ReadOnly log As log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
#Region "EVENT FOR CONTROL"

	Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
		If Not IsPostBack Then

			Translate()
			Me.EnableViewState = False
			Dim script As ScriptManager = ScriptManager.GetCurrent(Me.Page)
			If Not script Is Nothing AndAlso script.IsInAsyncPostBack Then
				ScriptManager.RegisterStartupScript(Me.Page, Me.Page.GetType, "duyjs", "ajaxJquery()", True)
			Else
				Me.Page.ClientScript.RegisterStartupScript(Me.Page.GetType(), "duyjs", String.Concat("Sys.Application.add_load(function(){", "ajaxJquery()", "});"), True)
			End If
			If Not Request.QueryString("Id").ToString.Equals("0") Then
				hidMSDSID.Value = Request.QueryString("Id")
			End If
			CheckData()
		End If
	End Sub

	Protected Sub Translate()
		lblSection13Title.Text = getTranslate("lblSection13Title", Session("LanguageId"), lblSection13Title.Text)
		lbSection13lbDisposes.Text = getTranslate("lbSection13lbDisposes", Session("LanguageId"), lbSection13lbDisposes.Text)
		lbSection13lbCaustion.Text = getTranslate("lbSection13lbCaustion", Session("LanguageId"), lbSection13lbCaustion.Text)
		lbSection13lbSolution.Text = getTranslate("lbSection13lbSolution", Session("LanguageId"), lbSection13lbSolution.Text)
		lbSection13lbProduct.Text = getTranslate("lbSection13lbProduct", Session("LanguageId"), lbSection13lbProduct.Text)
	End Sub

#End Region
#Region "PRIAVTE SUB AND FUNCTION"
	Sub CheckData()
		Using data As New VSEntities
			Dim LanguageId = Session("LanguageId").ToString()
			Dim p = (From q In data.MSDSSection13
			   Where q.LanguageId = LanguageId And q.MSDSId = hidMSDSID.Value
			   ).FirstOrDefault()
			If Not p Is Nothing Then
				txtS1311.Text = p.S1311
				txtS1321.Text = p.S1321
				txtS1331.Text = p.S1331
				txtS1341.Text = p.S1341
			End If
		End Using
	End Sub
#End Region
End Class
